//
//  BVNewFeatureCell.m
//  BuyVegetable
//
//  Created by yushanchang on 16/11/7.
//  Copyright © 2016年 com.yinding. All rights reserved.
//  新特性

#import "BVNewFeatureCell.h"
#import "BVTabBarController.h"
#import "UIView+TransitionAnimation.h"

@interface BVNewFeatureCell()

@property (nonatomic, strong) UIImageView *imageView;
@property (nonatomic, strong) UIButton *startButton;

@end

@implementation BVNewFeatureCell

- (void)setImages:(UIImage *)images {
    _images = images;
    self.imageView.image = images;
}

- (UIImageView *)imageView {
    if (!_imageView) {
        _imageView = [[UIImageView alloc] init];
        _imageView.frame = self.bounds;
        [self.contentView addSubview:_imageView];
    }
    return _imageView;
}

- (UIButton *)startButton {
    if (!_startButton) {
        _startButton = [[UIButton alloc] init];
        _startButton.frame = CGRectMake(70, ScreenH - 80, ScreenW - 140, 40);
        [_startButton setTitle:@"开启精菜" forState:UIControlStateNormal];
        [_startButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        _startButton.backgroundColor = [UIColor BVBaseOrangeColor];
        [_startButton addTarget:self action:@selector(startJingCaiClick) forControlEvents:UIControlEventTouchUpInside];
        [self.contentView addSubview:_startButton];
    }
    return _startButton;
}


- (void)setIndexPath:(NSIndexPath *)indexPath index:(NSInteger)index {
    if (indexPath.row == index - 1) {
        self.startButton.hidden = NO;
    }else{
        self.startButton.hidden = YES;
    }
}

#pragma mark -
#pragma mark - startButtonClick
- (void)startJingCaiClick {
    BVTabBarController *tabBarVC = [[BVTabBarController alloc] init];
    [BVKeyWindow addTransitionAnimationWithDuration:2.0f type:TransitionRippleEffect subType:FROM_BOTTOM];
    BVKeyWindow.rootViewController = tabBarVC;

}

- (void)awakeFromNib {
    [super awakeFromNib];
    
}

@end
